GADT meet Subtyping
نویسندگان
چکیده
While generalized abstract datatypes (GADT) are now considered well-understood, adding them to a language with a notion of subtyping comes with a few surprises. What does it mean for a GADT parameter to be covariant? The answer turns out to be quite subtle. It involves fine-grained properties of the subtyping relation that raise interesting design questions. We allow variance annotations in GADT definitions, study their soundness, and present a sound and complete algorithm to check them. Our work may be applied to real-world ML-like languages with explicit subtyping such as OCaml, or to languages with general subtyping constraints. Key-words: subtyping, datatypes, variance Part of this work has been done at IRILL ha l-0 07 44 29 2, v er si on 1 22 O ct 2 01 2 GADT avec sous-typage Résumé : Les types algébriques généralisés (Generalized Algebraic Datatypes, GADT) sont maintenant bien compris, mais leur ajout à un langage équipé de soustypage nous réservait quelques surprises. Qu’est-ce qu’être covariant pour un paramètre de GADT ? La réponse s’avère difficile. Elle met en jeu des propriétés fines de la relation de sous-typage qui soulèvent d’intéressantes problématiques de conception de langage. Nous permettons des annotations de variance dans les définitions de GADT, étudions leur correction, et présentons un algorithme correct et complet pour les vérifier. Notre travail peut s’appliquer à un langage complet inspiré de ML et avec sous-typage explicite, tel que OCaml, ou même à des langages avec des contraintes générales de sous-typage. Mots-clés : sous-typage, types de données, variance ha l-0 07 44 29 2, v er si on 1 22 O ct 2 01 2 GADT meet subtyping 3
منابع مشابه
GADTs Meet Subtyping
While generalized algebraic datatypes (GADTs) are now considered well-understood, adding them to a language with a notion of subtyping comes with a few surprises. What does it mean for a GADT parameter to be covariant? The answer turns out to be quite subtle. It involves fine-grained properties of the subtyping relation that raise interesting design questions. We allow variance annotations in G...
متن کاملGADT: A Probability Space ADT for Representing and Querying the Physical World
Large sensor networks are being widely deployed for measurement, detection, and monitoring applications. Many of these applications involve database systems to store and process data from the physical world. This data has inherent measurement uncertainties that are properly represented by continuous probability distribution functions (pdf’s). We introduce a new object-relational data type, the ...
متن کاملGenerating an Efficient Dynamics Multicast Tree under Grid Environment
The use of an efficient multicast tree can substantially speed up many communication-intensive MPI applications. This is even more crucial for Grid environment since MPI runtime has to work on wide area network with very different and unbalanced network bandwidth. This paper proposes a new and efficient algorithm called, GADT (Genetics Algorithm based Dynamics Tree) that can be used to generate...
متن کاملA Typical Synergy - Dynamic Types and Generalised Algebraic Datatypes
We present a typical synergy between dynamic types (dynamics) and generalised algebraic datatypes (GADTs). The former provides a clean approach to integrating dynamic typing in a statically typed language. It allows values to be wrapped together with their type in a uniform package, deferring type unification until run time using a pattern match annotated with the desired type. The latter allow...
متن کاملDetection and subtyping avian metapneumovirus from turkeys in Iran
Avian metapneumovirus (aMPV) causes diseases like rhinotracheitis in turkeys, swollen head syndrome in chickens and avian rhinotracheitis in other birds. Causing respiratory problems, aMPV adversely affects production and inflicts immense economic losses and mortalities, especially in turkey flocks. In recent years, several serological and molecular studies have been conducted on this virus, es...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید
ثبت ناماگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید
ورودعنوان ژورنال:
- CoRR
دوره abs/1210.5935 شماره
صفحات -
تاریخ انتشار 2012